import { } from 'react-native';

const http = (method, url, data, header ) => {
    new Promise((resolve, reject) => {
        fetch(url, {
            method: method || 'GET',
            body: data || {},
            headers: new Headers({
                "Content-Type": "application/json; charset=utf-8",
                ...header
            })
        }).then(res => {
            resolve(res.data);
        }).catch(err => {
            reject(err)
        })
    })
}

export { http };
